﻿; (function (window, undefined, $) {
    var submiting = false;

    $('#frmEdit').validator({
        rules: {
            // 自定义规则，如果通过返回true，否则返回错误消息
            //cusidcard: function (element, param, field) {
            //    var idtype = $("#Id").val();
            //    if (idtype == param[0]) {
            //        return /^.+$/.test($(element).val()) || "必填项";
            //    }
            //    return true;
            //}
        },
        fields: {
            '#Password': 'required',
            '#Password1': 'required',
            '#RePassword': 'required'
        },
        valid: function (form) {
            if (submiting) {
                return;
            }
            submiting = true;
            FormSubmit(form, function (res) {
                if (res.Status > 0) {
                    alert("操作成功！");
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                }
                else {
                    alert("操作失败！");
                }
                submiting = false;
            });
        }
    });




    $("#btnSave").click(function (e) {
        if ($("#Password").val() != "") {
            if ($("#hidepassword").val() != $("#Password").val())
                {
                     alert("密码错误！");
                     $("#Password").val("");
                     $("#Password").focus();
                     return;
                }
            else if ($("#Password1").val() != $("#RePassword").val())
                {
                     alert("两次输入密码不一致！请重新输入");
                     $("#Password1").val("");
                     $("#RePassword").val("");
                     $("#Password1").focus();
                     return;
                 }
           else {
                 $("#frmEdit").submit();
                }
        }
       
    });
    $("#btnReturn").click(function (e) {
        window.location.href = "/Member/Index.html";
    });



})(window, undefined, jQuery);